#parse argument

architecture=$1
matrix_decompressed_file=$2
matrix_comp_file=$3
output_dir=$4
lorem_ipsum_file=$5

permutation_str=""

# create encoding parameters

str="
xrnlib-cli \
    --encoding-conf -compiled-param -password-str "Password#01234" \
    --dump-encoding-param -encoding-param $output_dir/encoding_param_file.xf
"
echo ""; echo $str; echo ""
eval $str


# create random envelop

str="
head -c 4096 </dev/urandom >$output_dir/envelop.rnd
"
echo ""; echo $str; echo ""
eval $str


# make steganography raw

str="
xrnlib-cli \
    --make-steganography-raw  \
                       -source-file $output_dir/encoding_param_file.xf \
                       -envelop-file $output_dir/envelop.rnd \
                       -embedded-file $output_dir/embedded "

echo ""; echo $str; echo ""
eval $str


# extract steganography raw

str="
xrnlib-cli \
    --extract-steganography-raw -embedded-file $output_dir/embedded -raw-file $output_dir/encoding_param_file_extracted.xf "

echo ""; echo $str; echo ""
eval $str


# create encoding parameters

str="
xrnlib-cli \
    --decoding-conf -no-param \
    --encoding-conf -encoding-param $output_dir/encoding_param_file_extracted.xf -no-password \
    --decode-encode -to-decode $lorem_ipsum_file -to-encode $output_dir/encoded_lorem_ipsum.xf
"
echo ""; echo $str; echo ""
eval $str

str="
xrnlib-cli \
    --decoding-conf -encoding-param $output_dir/encoding_param_file_extracted.xf -no-password \
    --encoding-conf -no-param \
    --decode-encode -to-decode $output_dir/encoded_lorem_ipsum.xf -to-encode $output_dir/lorem_ipsum_decoded.txt
"
echo ""; echo $str; echo ""
eval $str

str=" 
cmp --silent $lorem_ipsum_file $output_dir/lorem_ipsum_decoded.txt && echo 'PASS' || echo 'FAIL'
"
echo ""; echo $str; echo ""
eval $str



